package com.whxy02.tolearn.app.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whxy02.tolearn.app.beans.Question;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface QuestionDao extends BaseMapper<Question> {

    @Select("select * from tb_question where subject_id=#{subject_id} and type_id=#{question_type_id} order by rand() limit 10 ")
    public List<Question> selectByRand(Integer subject_id,Integer question_type_id)throws Exception;
    @Select("select * from tb_question where subject_id=#{subject_id} and type_id =#{question_type_id} and tags_id=#{tags_id} order by rand() limit 10 ")
    public List<Question> selectWithTagsRand(Integer subject_id,Integer question_type_id,Integer tags_id)throws Exception;

}
